
/** 表格表头 */
export const tableColumns = (t: (msg:string) => string) => [
  {
    prop: 'id',
    type: 'selection',
    label: t('table.selection'),
    width: 55,
    reserveSelection: true
  },
  {
    prop: 'id',
    label: t('table.id'),
    minWidth: 100,
  },
  {
    prop: 'name',
    label: t('table.name'),
    minWidth: 200,
  },
  {
    prop: 'wx_user_id',
    label: t('table.wx_user_id'),
    minWidth: 120,
  },
  {
    prop: 'department',
    label: t('table.department'),
    minWidth: 120,
  },
  {
    prop: 'created_at',
    label: t('table.created_at'),
    minWidth: 180,
    format: 'date|YYYY-MM-DD HH:mm:ss',
  },
  {
    prop: 'status',
    label: t('table.status'),
    minWidth: 120,
  },
  {
    prop: 'action',
    label: t('table.operation'),
    width: 100,
    showOverflowTooltip: false,
    fixed: 'right',
  },
];

/** 表格搜索表单 */
export const tableSearchFormItems = (t: (msg:string) => string) => [
  {
    attrs: {
      label: t('search.name'),
      prop: 'name',
    },
    value: '',
    component: {
      is: 'el-input',
      props: {
        placeholder: t('search.name.placeholder'),
      },
    },
  },
  {
    attrs: {
      label: t('search.mobile'),
      prop: 'mobile',
    },
    value: '',
    component: {
      is: 'el-input',
      props: {
        placeholder: t('search.mobile.placeholder'),
      },
    },
  },
  {
    attrs: {
      label: t('search.wx_user_id'),
      prop: 'wx_user_id',
    },
    value: '',
    component: {
      is: 'el-input',
      props: {
        placeholder: t('search.wx_user_id.placeholder'),
      },
    },
  },
  {
    attrs: {
      label: t('search.department'),
      prop: 'wx_main_department_id',
    },
    value: '',
    component: {
      is: 'el-select',
      props: {
        filterable: true,
        placeholder: t('search.department.placeholder'),
      },
    },
    childrenComponent: {
      is: 'el-option',
      children: [],
    },
  },
  {
    attrs: {
      label: t('search.status'),
      prop: 'status',
    },
    value: '',
    component: {
      is: 'el-select',
      props: {
        placeholder: t('search.status.placeholder'),
      },
    },
    childrenComponent: {
      is: 'el-option',
      // '激活状态: 1=已激活，2=已禁用，4=未激活，5=退出企业'
      children: () => [
        {
          label: '未同步',
          value: 0,
        },
        {
          label: '已激活',
          value: 1,
        },
        {
          label: '已禁用',
          value: 2,
        },
        {
          label: '未激活',
          value: 4,
        },
        {
          label: '退出企业',
          value: 5,
        },
      ],
    },
  },
];
